{extend name="base"/}
{block name="resources"}
<style>
    .required { margin-right: 3px; }
    .ns-check-member { position: relative; }
    .ns-check-member .layui-btn { position: absolute; top: 0; right: 1px; border-color: #e5e5e5; padding: 0 10px; border-right: 0; }

    /*.ns-store-company, .ns-pay-company, .ns-pay-alipay, .ns-shop-own { display: none; }*/

    /* 关联会员 */
    .ns-search-result { border: 1px solid; padding: 15px 30px 15px 15px; display: flex; align-items: center; position: relative;margin-top:10px; }
    .ns-search-res-img { width: 50px; height: 50px; margin-right: 5px; text-align: center; line-height: 50px; }
    .ns-search-res-img img { max-width: 100%; max-height: 100%; }
    .ns-search-res-intro p { line-height: 24px; }
    .ns-search-res-close { position: absolute; top: 5px; right: 5px; }

    .ns-card-common:first-of-type {margin-top: 0;}
    .ns-form-row {margin-top: 0;}
    .ns-check-member .layui-input:focus+.layui-btn {border-color: #4685FD;}
    .ns-store-company, .ns-pay-company{margin-top: 10px;}
    #container{ width: 650px; height: 500px; }

    .upload_img_square {
        display: inline-block;
        width: 80px;
        height: 80px;
        line-height: 78px;
        font-size: 30px;
        color: #bbbbbb;
        cursor: pointer;
        border: 1px dashed #ccc;
        border-radius: 5px;
        text-align: center;
        margin-bottom: 10px;
        margin-right: 10px;
    }

    .upload_img_square_item {
        display: inline-block;
        float: left;
        width: 80px;
        height: 80px;
        position: relative;
        border: 1px dashed #e5e5e5;
        text-align: center;
        transition: background-color 0.3s ease;
        margin-bottom: 10px;
        margin-right: 10px;
    }
    .upload_img_square_item:hover {
        border: 1px dashed #ff8143;
        border-radius: 5px;
    }
    .upload_img_square_item:hover .operation {
        display: block;
    }
    .upload_img_square_item .img-wrap {
        width: 80px;
        font-size: 0;
        line-height: 79px;
        border-radius: 5px;
        overflow: hidden;
    }
    .upload_img_square_item .img-wrap img {
        width: calc(100% - 2px);
        height: calc(100% - 2px);
    }
    .upload_img_square_item .operation {
        position: absolute;
        top: 0;
        z-index: 10;
        width: 80px;
        height: 80px;
        line-height: 80px;
        background: rgba(0, 0, 0, 0.5);
        color: #fff;
        cursor: pointer;
        text-align: center;
        display: none;
    }
    .upload_img_square_item .operation i {
        font-size: 20px;
        margin-left: 10px;
    }
    .upload_img_square_item .operation i:first-child {
        margin-left: 0;
    }
    .upload_img_square_item .operation .replace_img {
        position: absolute;
        bottom: 0;
        width: 100%;
        height: 24px;
        color: #fff;
        background: rgba(0, 0, 0, 0.5);
        font-size: 12px;
        line-height: 24px;
    }

</style>
{/block}
{block name="main"}
<div class="layui-form ns-form" lay-filter="storeform">
    <!-- 店铺信息 -->
    <div class="layui-card ns-card-common ns-card-brief">
        <div class="layui-card-header">
            <span class="ns-card-title">店铺信息</span>
        </div>
        <div class="layui-card-body">

            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>关联人员：</label>
                <div class="layui-input-block ns-len-mid">
                    <select class="ns-category" name="member_id">
                        {volist name="$member_list" id="member"}
                        <option value="{$member.member_id}" disabled  {if $member.member_id == $shop_info.member_id} selected {/if} >{$member.nickname}/{$member.mobile}</option>
                        {/volist}
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>店铺名称：</label>
                <div class="layui-input-block">
                    <input name="site_name" type="text" lay-verify="required" value="{$shop_info.site_name}" class="layui-input ns-len-long" autocomplete="off">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>店铺分类：</label>
                <div class="layui-input-block ns-len-mid">
                    <select class="ns-category" name="category_id" lay-verify="required">
                        <option value="">选择主营行业</option>
                        {volist name="$shop_category_list" id="category"}
                        <option value="{$category.category_id}" {$shop_info.category_id==$category.category_id ? 'selected' : '' }>{$category.category_name}</option>
                        {/volist}
                    </select>
                </div>
            </div>

            <!--是否为自营-->
            <div class="layui-form-item">
                <label class="layui-form-label">是否自营：</label>
                <div class="layui-input-block" id="is_own">
                    <input type="radio" name="is_own" lay-filter="is_own" value="0" title="否" {if condition="$shop_info.is_own == 0"} checked {/if} >
                    <input type="radio" name="is_own" lay-filter="is_own" value="1" title="是" {if condition="$shop_info.is_own == 1"} checked {/if} >
                </div>
            </div>


            <!-- 商家自营等级 -->
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>店铺类型：</label>
                <div class="layui-input-block ns-len-mid">
                    <select class="ns-group" name="group_id" lay-filter="group">
                        <option value=""></option>
                        {volist name="shop_group_list" id="group"}
                        <option value="{$group.group_id}" {$shop_info.group_id==$group.group_id ? 'selected' : '' }>{$group.group_name}</option>
                        {/volist}
                    </select>
                </div>
            </div>

            <!--自提点地址-->
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>省市区：</label>
                <div class="layui-input-inline area-select">
                    <select name="province_id" lay-filter="province_id" lay-verify="province_id">
                        {foreach $province_list as $k => $v}
                        <option value="{$v.id}" {if $shop_info.province == $v.id}select{/if}>{$v.name}</option>
                        {/foreach}
                    </select>
                </div>

                <div class="layui-input-inline area-select">
                    <select name="city_id"  lay-filter="city_id" lay-verify="city_id">
                        <option value="">请选择城市</option>
                    </select>
                </div>

                <div class="layui-input-inline area-select">
                    <select name="district_id"  lay-filter="district_id" lay-verify="district_id">
                        <option value="">请选择区/县</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <div class="layui-input-block">
                    <input type="text" name="address"  placeholder="请填写的具体地址。" lay-verify="required"  value="{$shop_info.address}" autocomplete="off" class="layui-input ns-len-long address-content" value="">
                    <input type = "hidden" name="longitude" lay-verify="required" class="layui-input"  value="{$shop_info.longitude}" />
                    <input type = "hidden" name="latitude" lay-verify="required" class="layui-input"  value="{$shop_info.latitude}" />
                    <button class='layui-btn-primary layui-btn' onclick="refreshFrom();">查找地址</button>
                </div>
                <div class="ns-word-aux">点击查找地址可在地图上显示输入的地理位置</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">地图定位：</label>
                <div class="layui-input-block ns-special-length">
                    <div id="container" class="selffetch-map"></div>
                </div>
                <div class="ns-word-aux empty-address">请选择地理位置！在地图上点击得到的地理位置会自动填入到对应的输入框中</div>
            </div>


            <div class="layui-form-item time-type-view-all" >
                <label class="layui-form-label"><span class="required">*</span>营业时间：</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="startTime" lay-verify="start_time|required" placeholder="开始时间" value="" readonly >
                    <input type="hidden" class="layui-input" name="start_time" placeholder="开始时间" value="{$shop_info.start_time}">
                </div>
                <div class="layui-form-mid layui-word-aux">~</div>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="endTime" lay-verify="end_time|required" placeholder="结束时间" value="" readonly >
                    <input type="hidden" class="layui-input" name="end_time" placeholder="结束时间" value="{$shop_info.start_time}">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>联系人：</label>
                <div class="layui-input-block">
                    <input type="text" name="name" lay-verify="required" autocomplete="off" class="layui-input ns-len-long" value="{$shop_info.name}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>联系电话：</label>
                <div class="layui-input-block">
                    <input type="number" name="mobile" lay-verify="required" autocomplete="off" class="layui-input ns-len-long" value="{$shop_info.mobile}">
                </div>
                <div class="ns-word-aux">请输入联系人手机号</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>联系邮箱：</label>
                <div class="layui-input-block">
                    <input type="text" name="contact_email" lay-verify="required" autocomplete="off" class="layui-input ns-len-long" value="{$shop_info.contact_email}">
                </div>
                <div class="ns-word-aux">请输入联系人电子邮箱</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>店铺列表图片：</label>
                <div class="layui-input-block img-upload">
                    <div class="upload-img-block">
                        <div class="upload-img-box {notempty name="$shop_info['avatar']"}hover{/notempty}">
                            <div class="ns-upload-default" id="storeUpload">
                                {notempty name="$shop_info.avatar"}
                                <div id="preview_storeUpload" class="preview_img">
                                    <img layer-src src="{:img($shop_info.avatar)}" class="img_prev"/>
                                </div>
                                {else/}
                                <div class="upload">
                                    <img src="ADMIN_IMG/upload_img.png" data-id="storeUpload"/>
                                    <p>点击上传</p>
                                </div>
                                {/notempty}
                            </div>
                            <div class="operation">
                                <div>
                                    <i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
                                    <i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
                                </div>
                                <div class="replace_img js-replace">点击替换</div>
                            </div>
                            <input type="hidden" name="avatar"  value="{$shop_info.avatar}">
                        </div>
                    </div>
                </div>

                <div class="ns-word-aux">建议宽度<span class="pic_width">160</span>px  建议高度<span class="pic_height">160</span>px</div>
            </div>


            <div class="layui-form-item goods-image-wrap">
                <label class="layui-form-label"><span class="required">*</span>店铺详情图片：</label>
                <div class="layui-input-block">
                    <!--商品主图项-->
                    <div class="js-goods-image"></div>
                    <div class="item js-add-goods-image upload_img_square">+</div>
                </div>
                <!--                <div class="item js-add-goods-image upload_img_square">+</div>-->

                <input type="hidden" name="banner" value="{$shop_info.banner}" />
            </div>

        </div>
    </div>


    <!-- 公共部分 -->
    <!-- 联系人信息 -->
    <div class="layui-card ns-card-common ns-card-brief">
        <div class="layui-card-header">
            <span class="ns-card-title">联系人信息</span>
        </div>
        <div class="layui-card-body">

            <div class="layui-form-item">
                <label class="layui-form-label img-upload-lable ns-company-pic-front">身份证正面：</label>
                <div class="layui-input-block">
                    <div class="upload-img-block img-upload">
                        <div class="upload-img-box {notempty name="$shop_info['contacts_card_electronic_2']"}hover{/notempty}">
                            <div class="ns-upload-default" id="idCardPicFront">
                                {notempty name="$shop_info.contacts_card_electronic_2"}
                                <div id="preview_idCardUpload" class="preview_img">
                                    <img layer-src src="{:img($shop_info.contacts_card_electronic_2)}" class="img_prev"/>
                                </div>
                                {else/}
                                <div class="upload">
                                    <img src="ADMIN_IMG/upload_img.png" data-id="storeUpload"/>
                                    <p>点击上传</p>
                                </div>
                                {/notempty}
                            </div>
                            <div class="operation">
                                <div>
                                    <i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
                                    <i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
                                </div>
                                <div class="replace_img js-replace">点击替换</div>
                            </div>
                            <input type="hidden" name="contacts_card_electronic_2"  value="{$shop_info.contacts_card_electronic_2}">
                        </div>
                    </div>
                </div>
                <span class="ns-word-aux">上传申请人身份证正面，即有本人照片与身份证号的那一面</span>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label img-upload-lable ns-company-pic-back">身份证反面：</label>
                <div class="layui-input-block">
                    <div class="upload-img-block img-upload">
                        <div class="upload-img-box {notempty name="$shop_info['contacts_card_electronic_3']"}hover{/notempty}">
                            <div class="ns-upload-default" id="idCardPicBack">
                                {notempty name="$shop_info.contacts_card_electronic_3"}
                                <div id="preview_idCardPicBack" class="preview_img">
                                    <img layer-src src="{:img($shop_info.contacts_card_electronic_3)}" class="img_prev"/>
                                </div>
                                {else/}
                                <div class="upload">
                                    <img src="ADMIN_IMG/upload_img.png" data-id="storeUpload"/>
                                    <p>点击上传</p>
                                </div>
                                {/notempty}
                            </div>
                            <div class="operation">
                                <div>
                                    <i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
                                    <i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
                                </div>
                                <div class="replace_img js-replace">点击替换</div>
                            </div>
                            <input type="hidden" name="contacts_card_electronic_3" value="{$shop_info.contacts_card_electronic_3}">
                        </div>
                    </div>
                </div>
                <span class="ns-word-aux">上传申请人身份证反面，即有身份登记地址的那一面</span>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>证件姓名：</label>
                <div class="layui-input-block">
                    <input type="text" name="contacts_card_name"  lay-verify="required" value="{$shop_info.contacts_card_name}" autocomplete="off" class="layui-input  ns-len-long">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label ns-company-ident"><span class="required">*</span>证件号码：</label>
                <div class="layui-input-inline">
                    <input name="contacts_card_no" type="text" lay-verify="idcard|required" value="{$shop_info.contacts_card_no}" class="layui-input ns-len-long" autocomplete="off">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>证件地址：</label>
                <div class="layui-input-block">
                    <input type="text" name="legal_addr"  lay-verify="required" value="{$shop_info.legal_addr}" autocomplete="off" class="layui-input  ns-len-long">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>证件类型：</label>
                <div class="layui-input-block ns-len-mid">
                    <select name="contacts_card_type" lay-verify="required">
                        <option value="">请选择证件类型</option>
                        {foreach $id_card_type_list as $id_card_type_list_k => $id_card_type_list_v}
                        <option value="{$id_card_type_list_v}" {if $id_card_type_list_v == $shop_info.contacts_card_type}selected {/if}>{$id_card_type_list_v}</option>
                        {/foreach}
                    </select>
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">有效期类型：</label>
                <div class="layui-input-block" id="legal_cert_validity_type">
                    <input type="radio" name="legal_cert_validity_type" lay-filter="legalCertValidityType" value="1" title="长期有效" {if $shop_info.legal_cert_validity_type == 1}checked {/if}>
                    <input type="radio" name="legal_cert_validity_type" lay-filter="legalCertValidityType" value="0" title="非长期有效" {if $shop_info.legal_cert_validity_type == 0}checked {/if}>
                </div>
            </div>


            <div class="layui-form-item time-type-view-all" >
                <label class="layui-form-label"><span class="required">*</span>证件有效期：</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="idCardStartTime" lay-verify="id_card_start_time|required" placeholder="证件有效期开始时间" value="" readonly >
                    <input type="hidden" class="layui-input" name="contacts_card_start_time" placeholder="证件有效期开始时间" value="{$shop_info.contacts_card_start_time}">
                </div>
                <div class="layui-form-mid layui-word-aux">~</div>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="idCardEndTime" lay-verify="id_card_end_time|required" placeholder="证件有效期结束时间" value="" readonly >
                    <input type="hidden" class="layui-input" name="contacts_card_end_time" placeholder="证件有效期结束时间" value="{$shop_info.contacts_card_end_time}">
                </div>
            </div>
            <!--<div class="layui-form-item">
                <label class="layui-form-label ns-company-name">联系人姓名：</label>
                <div class="layui-input-inline">
                    <input name="contacts_name" type="text" class="layui-input ns-len-long" autocomplete="off">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label ns-company-phone">联系人手机：</label>
                <div class="layui-input-block">
                    <input name="contacts_mobile" type="text" lay-verify="mobile" class="layui-input ns-len-long" autocomplete="off">
                </div>
                <span class="ns-word-aux">请填写有效的手机号，如有问题可通过该手机号联系到商家</span>
            </div>-->


        </div>
    </div>

    <!-- 开户行信息 -->
    <!-- 结算信息 -->
    <div class="layui-card ns-card-common ns-card-brief">
        <div class="layui-card-header">
            <span class="ns-card-title">开户行信息</span>
        </div>
        <div class="layui-card-body">

            <!--银行卡-->
            <div class="ns-pay-bank">
                <div class="layui-form-item">
                    <label class="layui-form-label ns-pay-alipay-name"><span class="required">*</span>开户人：</label>
                    <div class="layui-input-inline">
                        <input name="settlement_bank_account_name" id="settlement_bank_account_name"  value="{$shop_info.settlement_bank_account_name}" lay-verify="required" type="text"  class="layui-input ns-len-long" autocomplete="off" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="required">*</span>开户行：</label>
                    <div class="layui-input-inline">
                        <input name="settlement_bank_name" id="settlement_bank_name" type="text"  value="{$shop_info.settlement_bank_name}" lay-verify="required"  class="layui-input ns-len-long" autocomplete="off" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label ns-pay-alipay-account"><span class="required">*</span>银行卡号：</label>
                    <div class="layui-input-inline">
                        <input name="settlement_bank_account_number" id="settlement_bank_account_number" lay-verify="required"  type="text" value="{$shop_info.settlement_bank_account_number}" class="layui-input ns-len-long" autocomplete="off" lay-verify="required">
                    </div>
                </div>

                <div class="layui-form-item" data-flag="area">
                    <label class="layui-form-label"><span class="required">*</span>开户银行所在地：</label>

                    <div class="layui-input-inline ns-len-mid">
                        <select class="bank-province" name="bank_province" data-type="province" data-init="{$shop_info.bank_province}" lay-filter="bankProvince"></select>
                    </div>
                    <div class="layui-input-inline ns-len-mid">
                        <select class="bank-city" name="bank_city" data-type="city" data-init="{$shop_info.bank_city}" lay-filter="bankCity"></select>
                    </div>
                    <div class="layui-input-inline ns-len-mid">
                        <select class="bank-district" name="bank_district" data-type="district" data-init="{$shop_info.bank_district}" lay-filter="bankDistrict"></select>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="required">*</span>银行卡类型：</label>
                    <div class="layui-input-block ns-len-mid">
                        <select name="settlement_bank_type" lay-verify="required">
                            <option value="1" {if $shop_info['settlement_bank_type'] == 1} selected {/if}>对公</option>
                            <option value="2" {if $shop_info['settlement_bank_type'] == 2} selected {/if}>对私</option>
                            <option value="3" {if $shop_info['settlement_bank_type'] == 3} selected {/if}>对私非法人</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="required">*</span>银行卡图片：</label>
                    <div class="layui-input-block img-upload">
                        <div class="upload-img-block">
                            <div class="upload-img-box {notempty name="$shop_info['settlement_bank_img']"}hover{/notempty}">
                                <div class="ns-upload-default" id="bankUpload">
                                    {notempty name="$shop_info.settlement_bank_img"}
                                    <div id="preview_bankUpload" class="preview_img">
                                        <img layer-src src="{:img($shop_info.settlement_bank_img)}" class="img_prev"/>
                                    </div>
                                    {else/}
                                    <div class="upload">
                                        <img src="ADMIN_IMG/upload_img.png" data-id="bankUpload"/>
                                        <p>点击上传</p>
                                    </div>
                                    {/notempty}
                                </div>
                                <div class="operation">
                                    <div>
                                        <i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
                                        <i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
                                    </div>
                                    <div class="replace_img js-replace">点击替换</div>
                                </div>
                                <input type="hidden" name="settlement_bank_img" value="{$shop_info.settlement_bank_img}">
                            </div>
                        </div>
                    </div>
                </div>

                <!--<div class="layui-form-item" data-flag="area" hidden>
                    <label class="layui-form-label"><span class="required">*</span>结算开户银行所在地：</label>
                    <div class="layui-input-inline">
                        <input name="settlement_bank_address" id="settlement_bank_address" type="text" value="" class="layui-input ns-len-long" autocomplete="off" lay-verify="required">
                    </div>
                </div>-->
            </div>
            <!-- 支付宝 -->

        </div>
    </div>


    <!-- 申请类型 -->
    <!--<div class="layui-card ns-card-common ns-card-brief">
        <div class="layui-card-header">
            <span class="ns-card-title">申请类型</span>
        </div>
        <div class="layui-card-body">
            <div class="layui-form-item">
                <label class="layui-form-label">申请类型：</label>
                <div class="layui-input-block" id="cert_type">
                    <input type="radio" name="cert_type" lay-filter="certType" value="1" title="个人店铺" {if $shop_info.cert_type == 1} checked {/if}>
                    <input type="radio" name="cert_type" lay-filter="certType" value="2" title="企业店铺" {if $shop_info.cert_type == 2} checked {/if}>
                </div>
            </div>
        </div>
    </div>-->

    <!-- 营业执照 税务 -->
    <!-- 企业店铺独有 -->
{if $shop_info.cert_type == 2}
    <div class="ns-store-company ">
        <div class="layui-card ns-card-common ns-card-brief">
            <div class="layui-card-header">
                <span class="ns-card-title">营业执照</span>
            </div>
            <div class="layui-card-body">

                <div class="layui-form-item">
                    <label class="layui-form-label">经营类型：</label>
                    <div class="layui-input-block" id="busi_type">
                        <input type="radio" name="busi_type" lay-filter="busiType" value="1" title="实体" {if $shop_info.busi_type == 1} checked {/if}>
                        <input type="radio" name="busi_type" lay-filter="busiType" value="2" title="虚拟" {if $shop_info.busi_type == 2} checked {/if}>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label img-upload-lable">营业执照：</label>
                    <div class="layui-input-block">
                        <div class="upload-img-block img-upload">
                            <div class="upload-img-box {notempty name="$shop_info['business_licence_number_electronic']"}hover{/notempty}"">
                                <div class="ns-upload-default" id="license">
                                    {notempty name="$shop_info.business_licence_number_electronic"}
                                    <div id="preview_frontPicUpload" class="preview_img">
                                        <img layer-src src="{:img($shop_info.business_licence_number_electronic)}" class="img_prev"/>
                                    </div>
                                    {else/}
                                    <div class="upload">
                                        <img src="ADMIN_IMG/upload_img.png" data-id="frontPicUpload"/>
                                        <p>点击上传</p>
                                    </div>
                                    {/notempty}
                                </div>
                                <div class="operation">
                                    <div>
                                        <i title="图片预览" class="iconfont iconreview js-preview" style="margin-right: 20px;"></i>
                                        <i title="删除图片" class="layui-icon layui-icon-delete js-delete"></i>
                                    </div>
                                    <div class="replace_img js-replace">点击替换</div>
                                </div>
                                <input type="hidden" name="business_licence_number_electronic" value="{$shop_info.business_licence_number_electronic}">
                            </div>
                        </div>
                    </div>
                    <span class="ns-word-aux">请上传营业执照传真图片或者照片，营业执照包括边框内容要全部显示，不能遮挡</span>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">统一社会信用码：</label>
                    <div class="layui-input-block">
                        <input name="business_licence_number" type="text" class="layui-input ns-len-long" autocomplete="off" value="{$shop_info.business_licence_number}">
                    </div>
                    <span class="ns-word-aux">请填写三证合一之后的营业执照上的统一社会信用代码</span>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">有效期类型：</label>
                    <div class="layui-input-block" id="license_time_type">
                        <input type="radio" name="license_time_type" lay-filter="licenseTimeType" value="1" title="长期有效" {if $shop_info.license_time_type == 1} checked {/if}>
                        <input type="radio" name="license_time_type" lay-filter="licenseTimeType" value="0" title="有期限" {if $shop_info.license_time_type == 0} checked {/if}>
                    </div>
                </div>


                <div class="layui-form-item" id="license_time">
                    <label class="layui-form-label">证件有效期：</label>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" id="businessLicenseStartTime" lay-verify="business_license_start_time" placeholder="营业执照开始时间" value="" readonly >
                        <input type="hidden" class="layui-input" name="license_start_date" placeholder="开始时间" value="{$shop_info.license_start_date}">
                    </div>
                    <div class="layui-form-mid layui-word-aux">~</div>
                    <div class="layui-input-inline">
                        <input type="text" class="layui-input" id="businessLicenseEndTime" lay-verify="business_license_end_time" placeholder="营业执照结束时间" value="" readonly >
                        <input type="hidden" class="layui-input" name="license_end_date" placeholder="结束时间" value="{$shop_info.license_end_date}">
                    </div>
                </div>



            </div>
        </div>
    </div>
{/if}

    <div class="layui-card ns-card-common ns-card-brief">
        <div class="layui-card-header">
            <span class="ns-card-title">其他</span>
        </div>
        <div class="layui-card-body">
            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>排序：</label>
                <div class="layui-input-ns">
                    <input name="sort" type="number" lay-verify="required" value="{$shop_info.sort}" class="layui-input ns-len-long" autocomplete="off">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><span class="required">*</span>抽佣比例：</label>
                <div class="layui-input-block">
                    <input type="number" name="commission_rate" autocomplete="off" class="layui-input  ns-len-long" value="{$shop_info.commission_rate}">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">推荐首页：</label>
                <div class="layui-input-block">
                    <input type="radio" name="is_recommend" value="1" title="是" lay-filter="is_recommend" {if $shop_info.is_recommend == 1} checked {/if}>
                    <input type="radio" name="is_recommend" value="0" title="否" lay-filter="is_recommend" {if $shop_info.is_recommend == 0} checked {/if}>
                </div>
            </div>

        </div>
    </div>


    <div class="ns-single-filter-box">
        <div class="ns-form-row">
            <button class="layui-btn ns-bg-color" lay-submit lay-filter="save">保存</button>
            <button class="layui-btn layui-btn-primary" onclick="back()">返回</button>
        </div>
    </div>
<input type="hidden" value="{$shop_info.site_id}" name="site_id" />
    <!-- 隐藏域 -->
    <!--	<input type="hidden" name="contacts_card_electronic_2" />   &lt;!&ndash; 身份证正面 &ndash;&gt;-->
    <!--	<input type="hidden" name="contacts_card_electronic_3" />   &lt;!&ndash; 身份证反面 &ndash;&gt;-->
    <!--	<input type="hidden" name="business_licence_number_electronic" />   &lt;!&ndash; 营业执照电子版 &ndash;&gt;-->
    <!-- <input type="hidden" name="tax_registration_certificate_electronic" /> -->   <!-- 税务登记证号电子版 -->
</div>

<!--详情图片-->
<script type="text/html" id="houseNumberImage">
    {{# if(d.list.length){ }}
    {{# for(var i=0;i<d.list.length;i++){ }}
    <div class="item upload_img_square_item" data-index="{{i}}">
        <div class="img-wrap">
            <img src="{{ns.img(d.list[i])}}" layer-src>
        </div>
        <div class="operation">
            <i title="图片预览" class="iconfont iconreview js-preview"></i>
            <i title="删除图片" class="layui-icon layui-icon-delete js-delete" data-index="{{i}}"></i>
            <!--            <div class="replace_img img_show" data-index="{{i}}">点击替换</div>-->
        </div>
    </div>
    {{# } }}

    {{# } }}

</script>
{/block}
{block name="script"}
<script type="text/javascript">
    window._AMapSecurityConfig = {
        securityJsCode:'32f0302062f41190e845f1ab073cda3b',
    }
</script>
<script type="text/javascript" src="{:get_http_type()}://webapi.amap.com/maps?v=1.4.6&amp;key={if empty($map_key['gaode_map_key'])}af48136f5a3f33efe58cb118e0ea139c{else/}{$map_key['gaode_map_key']}{/if}"></script>
<!--<script type="text/javascript" src="{:get_http_type()}://webapi.amap.com/maps?v=1.4.6&amp;key={if empty($map_key['gaode_map_key'])}2df5711d4e2fd9ecd1622b5a53fc6b1d{else/}{$map_key['gaode_map_key']}{/if}"></script>-->
<script type="text/javascript" src="SHOP_JS/address.js"></script>
<script type="text/javascript" src="STATIC_JS/map_address.js"></script>
<script src="ADMIN_JS/address.js"></script>
<script src="__STATIC__/ext/drag-arrange.js"></script>

<script>
    var houseNumberImage = [];//详情图片
    var map_class;
    const GOODS_IMAGE_MAX = 8;//商品主图数量
    var laytpl;
    layui.use(['form','laydate','upload','laytpl'], function() {
        laytpl = layui.laytpl;
        var upload = layui.upload;
        var laydate = layui.laydate;
        var form = layui.form,
            $ = layui.jquery,
            payType = 1, //结算类型
            autotrophy = 0,//自营类型
            repeat_flag = false; //防重复标识

        initArea(form);

        houseNumberImage = $("input[name='banner']").val().split(",");
        refresHouseNumberImage();

        var initdata = {province_id : '{$shop_info.province}', city_id : '{$shop_info.city}', district_id : '{$shop_info.district}'};
        initAddress(initdata, "storeform");

        if('{$shop_info.latitude}' == "" || '{$shop_info.longitude}' == ""){
            var latlng = {lat:'',lng:''};
        }else{
            var latlng = {lat:'{$shop_info.latitude}',lng:'{$shop_info.longitude}'};
        }

        //地图展示
        map_class = new mapClass("container",latlng);

        form.render();

        upload.render({
            elem: '.js-add-goods-image' //绑定元素
            ,url:ns.url('admin/upload/upload')
            ,accept: 'images' //上传图片
            ,multiple: true //允许多文件上传
            ,before: function(obj){
                //do something
                console.error(obj)
            }
            ,done: function(res){
                console.error(res)
                //上传完毕回调
                if(res.code > 0){ //假设成功返回的code为0
                    if (houseNumberImage.length < GOODS_IMAGE_MAX) houseNumberImage.push(res.data.pic_path);
                    refresHouseNumberImage();
                }
            }
            ,error: function(){
                //请求出错处理
            }
        });

        var store_upload = new Upload({
            elem: '#storeUpload',
            url: ns.url("admin/upload/upload"),
        });

        var bank_upload = new Upload({
            elem: '#bankUpload',
            url: ns.url("admin/upload/upload"),
        });

        //时间选择器
        laydate.render({
            elem: '#startTime'
            , type: 'time'
            ,value: "{:date('H:i', strtotime(date('Y-m-d')) + $shop_info.start_time)}"
            ,format:'HH:mm'
            ,done: function(value, date, endDate){
                var time = date.hours * 3600 + date.minutes * 60 + date.seconds;
                $("input[name=start_time]").val(time);
            }
        });
        //时间选择器
        laydate.render({
            elem: '#endTime'
            , type: 'time'
            ,value: "{:date('H:i', strtotime(date('Y-m-d')) + $shop_info.end_time)}"
            ,format:'HH:mm'
            ,done: function(value, date, endDate){
                var time = date.hours * 3600 + date.minutes * 60 + date.seconds;
                $("input[name=end_time]").val(time);
            }
        });

        laydate.render({
            elem: '#idCardStartTime',
            type: 'date',
            value: "{$shop_info.contacts_card_start_time}",
            format:'yyyy-MM-dd',
            done: function(value) {
                $("input[name=contacts_card_start_time]").val(value);
            }
        });

        laydate.render({
            elem: '#idCardEndTime',
            type: 'date',
            value: "{$shop_info.contacts_card_end_time}",
            format:'yyyy-MM-dd',
            done: function(value) {
                $("input[name=contacts_card_end_time]").val(value);
            }
        });


        laydate.render({
            elem: '#businessLicenseStartTime',
            type: 'date',
            value: "{$shop_info.license_start_date}",
            format:'yyyy-MM-dd',
            done: function(value) {
                $("input[name=license_start_date]").val(value);
            }
        });

        laydate.render({
            elem: '#businessLicenseEndTime',
            type: 'date',
            value: "{$shop_info.license_end_date}",
            format:'yyyy-MM-dd',
            done: function(value) {
                $("input[name=license_end_date]").val(value);
            }
        });

        // 申请人身份证正面
        var idCardPicFront_upload = new Upload({
            elem: '#idCardPicFront',
            url: ns.url("admin/upload/upload")
        });

        // 申请人身份证反面
        var idCardPicBack_upload = new Upload({
            elem: '#idCardPicBack',
            url: ns.url("admin/upload/upload")
        });

        // 营业执照电子版
        var license_upload = new Upload({
            elem: '#license',
            url: ns.url("admin/upload/upload")
        });

        form.on('radio(certType)', function(data) { //为企业店铺时，显示企业独有部分，否则隐藏
            var value = data.value;
            if (value == 1) {
                $(".ns-store-company").hide();
            } else {
                $(".ns-store-company").show();

            }
        });

        form.on('radio(licenseTimeType)', function(data){
            var value = data.value;

            if (value == 1){
                $("#license_time").hide();
            } else {
                $("#license_time").show();
            }
        });

        /**
         * 表单验证
         */
        form.verify({
            /*required : function(value, item){
                console.error(value)
                console.error(item)
                if(value == ''){
                    return '请选择省份';
                }
            },*/
            province_id : function(value, item){
                if(value == ''){
                    return '请选择省份';
                }
            },
            city_id : function(value, item){
                if(value == ''){
                    return '请选择城市';
                }
            },
            district_id : function(value, item){
                if(value == ''){
                    return '请选择区/县';
                }
            },
            mobile: function(value) {
                var reg = /^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\d{8}$/;
                if (value == '') {
                    return;
                }
                if (!reg.test(value)) {
                    return '请输入正确的手机号码!';
                }
            },
            idcard: function(value) {
                var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
                if (value == '') {
                    return;
                }
                if (!reg.test(value)) {
                    return '请输入正确的身份证号!';
                }
            },
            bankprovince: function(value){
                if (value == -1) return '请选择省';
            },
            bankcity: function(value){
                if (value == -1) return '请选择市';
            },
            bankdistrict: function(value, item){
                if (value == -1 && $(item).find('option').length > 1) return '请选择区县';
            },
        });

        form.on('submit(save)', function(data) {

            if( data.field.longitude == "" || data.field.latitude == ""){
                layer.msg('请确认地理位置!');
                $(".empty-address").show();
                return;
            }else{
                $(".empty-address").hide();
            }
            var province_name = $("select[name=province_id] option:selected").text();
            var city_name = $("select[name=city_id] option:selected").text();
            var district_name = $("select[name=district_id] option:selected").text();

            data.field.province = data.field.province_id;
            data.field.city = data.field.city_id;
            data.field.district = data.field.district_id;


            //地址name
            data.field.province_name = province_name;
            data.field.city_name = city_name;
            data.field.district_name = district_name;

            data.field.full_address = province_name + city_name + district_name;
            //data.field.full_address = full_address.toString();
            data.field.banner = houseNumberImage.toString();


            data.field.category_name = $("select[name=category_id] option:selected").text();
            data.field.group_name = $("select[name=group_id] option:selected").text();

            var bank_province_name = $("select[name=bank_province] option:selected").text();
            var bank_city_name = $("select[name=bank_city] option:selected").text();
            var bank_district_name = $("select[name=bank_district] option:selected").text();

            data.field.bank_province_name = bank_province_name;
            data.field.bank_city_name = bank_city_name;
            data.field.bank_district_name = bank_district_name;

            if (repeat_flag) return false;
            repeat_flag = true;

            //删除图片
            if(!data.field.contacts_card_electronic_2) idCardPicFront_upload.delete();
            if(!data.field.contacts_card_electronic_3) idCardPicBack_upload.delete();
            if(!data.field.business_licence_number_electronic) license_upload.delete();
            if(!data.field.avatar) store_upload.delete();
            if(!data.field.settlement_bank_img) bank_upload.delete();
            //添加
            $.ajax({
                type: 'POST',
                url: ns.url("admin/shop/editShop"),
                data: data.field,
                dataType: 'JSON',
                success: function(res) {
                    repeat_flag = false;
                    if (res.code == 0) {
                        layer.confirm('编辑成功', {
                            title: '操作提示',
                            btn: ['返回列表', '继续操作'],
                            yes: function() {
                                location.href = ns.url("admin/shop/lists")
                            },
                            btn2: function() {
                                location.reload();
                            }
                        });
                    } else {
                        layer.msg(res.message);
                    }
                }
            });
        });


    })


    /**
     * 重新渲染表单
     */
    function refreshFrom(){
        form.render();
        orderAddressChange();//改变地址
        map_class.mapChange();
    }

    //动态改变订单地址赋值
    function orderAddressChange(){
        map_class.address.province = $("select[name=province_id]").val();
        map_class.address.province_name = $("select[name=province_id] option:selected").text();
        map_class.address.city = $("select[name=city_id]").val();
        map_class.address.city_name = $("select[name=city_id] option:selected").text();
        map_class.address.district = $("select[name=district_id]").val();
        map_class.address.district_name = $("select[name=district_id] option:selected").text();
        map_class.address.address = $("input[name=address]").val()
    }

    /**
     * 地址下拉框（主要用于坐标记录）
     */
    function selectCallBack(){
        $("input[name=longitude]").val(map_class.address.longitude);//坐标
        $("input[name=latitude]").val(map_class.address.latitude);//坐标
    }

    //地图点击回调事件
    function mapChangeCallBack(){
        $("input[name=address]").val(map_class.address.address);//详细地址
        $("input[name=longitude]").val(map_class.address.longitude);//坐标
        $("input[name=latitude]").val(map_class.address.latitude);//坐标

        $.ajax({
            type : "POST",
            dataType: 'JSON',
            url : ns.url("shop/address/getGeographicId"),
            async : true,
            data : {
                "address" : map_class.address.area
            },
            success : function(data) {
                map_class.address.province = data.province_id;
                map_class.address.city = data.city_id;
                map_class.address.district = data.district_id;
                map_class.address.township = data.subdistrict_id;
                map_class.map_change = false;
                form.val("storeform", {
                    "province_id": data.province_id
                });
                $("select[name=province_id]").change();
                form.val("storeform", {
                    "city_id": data.city_id
                });
                $("select[name=city_id]").change();
                form.val("storeform", {
                    "district_id": data.district_id
                });
                refreshFrom();//重新渲染form
                map_class.map_change = true;
            }
        });
    }

    //渲染门牌号主图列表
    function refresHouseNumberImage() {
        var goods_image_template = $("#houseNumberImage").html();
        var data = {
            list: houseNumberImage,
            max: GOODS_IMAGE_MAX
        };

        laytpl(goods_image_template).render(data, function (html) {

            $(".js-goods-image").html(html);

            //加载图片放大
            loadImgMagnify();

            if (houseNumberImage.length) {

                //预览
                $(".js-goods-image .js-preview").click(function () {
                    $(this).parent().prev().find("img").click();
                });

                //图片删除
                $(".js-goods-image .js-delete").click(function () {
                    var index = $(this).attr("data-index");
                    houseNumberImage.splice(index, 1);
                    refresHouseNumberImage();
                });

                // 拖拽
                $('.js-goods-image .upload_img_square_item').arrangeable({
                    //拖拽结束后执行回调
                    callback: function (e) {
                        var indexBefore = $(e).attr("data-index");//拖拽前的原始位置
                        var indexAfter = $(e).index();//拖拽后的位置
                        var temp = houseNumberImage[indexBefore];
                        houseNumberImage[indexBefore] = houseNumberImage[indexAfter];
                        houseNumberImage[indexAfter] = temp;
                        refresHouseNumberImage();
                    }
                });
            }

            //最多传十张图
            if (houseNumberImage.length < GOODS_IMAGE_MAX) {
                $(".js-add-goods-image").show();
            } else {
                $(".js-add-goods-image").hide();
            }


        });
    }
</script>
{/block}